#startAndOffsetEdits.py
#Finds edits by start year and offset year in ALL namespaces
#
#HoOC
#Test with yearTester.txt

import sys
import os
import collections


def createFiles():
	f = open(sys.argv[1])
	openDict = {}
	
	for line in f:
		pieces = line.split('\t')
		year = pieces[3].split('-')[0]
		fileName = "startYears/"+year+".txt"
		if fileName not in openDict:
			fileVar = open(fileName, "a")
			openDict[fileName] = fileVar
		else:
			fileVar = openDict[fileName]

		fileVar.write(line)
		
	for fileVar in openDict.values():	
		fileVar.close()

createFiles()
